/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package taganalysistoolsclient;

import elaborate.tag_analysis.model.Resource;
import elaborate.tag_analysis.model.TURRelation;
import elaborate.tag_analysis.model.Tag;
import elaborate.tag_analysis.model.User;
import elaborate.tag_analysis.restws.client.ResourceDao;
import elaborate.tag_analysis.restws.client.TURRelationDao;
import elaborate.tag_analysis.restws.client.TagDao;
import elaborate.tag_analysis.restws.client.UserDao;
import java.util.List;

/**
 *
 * @author lendle
 */
public class TagAnalysisToolsClient5 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {
        // TODO code application logic here
        TURRelationDao dao = new TURRelationDao("http://taganalysis.appspot.com/rest/tur");
        List<TURRelation> turs = dao.findAll("delicious");
        if (turs != null) {
            for (TURRelation tur : turs) {
                System.out.println(tur.getId());
                dao.deleteTURRelation(tur.getApplicationId(), tur.getId());
            }
        }

        TagDao tagDao = new TagDao("http://taganalysis.appspot.com/rest/tag");
        List<Tag> tags = tagDao.findAll("delicious");
        if (tags != null) {
            for (Tag tag : tags) {
                System.out.println(tag.getId());
                tagDao.deleteTag(tag.getApplicationId(), tag.getId());
            }
        }

        ResourceDao resourceDao = new ResourceDao("http://taganalysis.appspot.com/rest/resource");
        List<Resource> resources = resourceDao.findAll("delicious");
        if (resources != null) {
            for (Resource resource : resources) {
                System.out.println(resource.getId());
                resourceDao.deleteResource(resource.getApplicationId(), resource.getId());
            }
        }

        UserDao userDao = new UserDao("http://taganalysis.appspot.com/rest/user");
        List<User> users = userDao.findAll("delicious");
        if (users != null) {
            for (User user : users) {
                System.out.println(user.getId());
                userDao.deleteResource(user.getApplicationId(), user.getId());
            }
        }
    }
}
